Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [IOBP-502] Disable swipe back while payment outcome showed #5434

Merged
merged 8 commits into from
Jan 25, 2024

Conversation

Hantex9
Copy link
Contributor

@Hantex9 Hantex9 commented Jan 24, 2024

Short description

This PR disables the swipe-back on iOS devices and the Android hardware back button when the payment outcome screen is shown.

List of changes proposed in this pull request

  • In the payment outcome screen has been added the custom hook useAvoidHardwareBackButton in order to disable the Android back button;
  • In the payment outcome screen has added a hook that disables the gestures both on the current navigation and the parent navigation (This is a workaround that can be solved by introducing react-navigation v6)

How to test

If you complete a new payment flow until you reach the outcome screen, you shouldn't be able to return to the previous screen.

@Hantex9 Hantex9 added the IO-Bonus e pagamenti IO - Bonus e pagamenti label Jan 24, 2024
@Hantex9 Hantex9 requested a review from a team as a code owner January 24, 2024 14:21
@pagopa-github-bot pagopa-github-bot changed the title chore: [IOBP-502] Disable swipe back while payment outcome showed feat: [IOBP-502] Disable swipe back while payment outcome showed Jan 24, 2024
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Jan 24, 2024

Affected stories

  • 🌟 IOBP-502: Disabilitare la possibilità di andare indietro quando mostrata la schermata di outcome pagamento
    subtask of
    • 🌟 IOBP-325: Esito flusso di pagamento

Generated by 🚫 dangerJS against e780a48

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (e374369) 47.42% compared to head (86f5258) 47.42%.
Report is 2 commits behind head on master.

❗ Current head 86f5258 differs from pull request most recent head e780a48. Consider uploading reports for the commit e780a48 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5434      +/-   ##
==========================================
- Coverage   47.42%   47.42%   -0.01%     
==========================================
  Files        1603     1603              
  Lines       33641    33643       +2     
  Branches     8219     8219              
==========================================
  Hits        15955    15955              
- Misses      17628    17630       +2     
  Partials       58       58              
Files Coverage Δ
...tV3/payment/screens/WalletPaymentOutcomeScreen.tsx 1.81% <0.00%> (-0.23%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51caedd...e780a48. Read the comment docs.

Copy link
Contributor

@forrest57 forrest57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this implementation untidy, but I've found no better way to make it work to spec, so LGTM as long as we also track a task to remove this once we upgrade react-navigation 👍

Comment on lines 53 to 64
// This is a workaround to disable swipe back gesture on this screen
// .. it should be removed as soon as the migration to react-navigation v6 is completed
React.useEffect(() => {
// Disable swipe
navigation.setOptions({ gestureEnabled: false });
navigation.getParent()?.setOptions({ gestureEnabled: false });
// Re-enable swipe after going back
return () => {
navigation.getParent()?.setOptions({ gestureEnabled: true });
};
}, [navigation]);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a reference to the ticket to work on later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! Added into 86f5258

Copy link
Contributor

@mastro993 mastro993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hantex9 Hantex9 merged commit 660d955 into master Jan 25, 2024
6 checks passed
@Hantex9 Hantex9 deleted the IOBP-502-disable-back-while-outcome-showed branch January 25, 2024 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO-Bonus e pagamenti IO - Bonus e pagamenti
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants